﻿CREATE TABLE [entity].[Contact] (
    [ContactID]           INT           IDENTITY (1, 1) NOT NULL,
    [EntityID]            INT           NULL,
    [ContactTypeID]       INT           NULL,
    [Value]               VARCHAR (500) NULL,
    [PreferredContact]    BIT           NULL,
    [EmailCorrespondence] BIT           NULL,
    [TextMessaging]       BIT           NULL,
    [CreatedBy]           VARCHAR (50)  NULL,
    [CreatedDate]         DATETIME      NULL,
    [UpdatedBy]           VARCHAR (50)  NULL,
    [UpdatedDate]         DATETIME      NULL,
    [EndDate]             DATETIME      NULL,
    CONSTRAINT [PK_Contact] PRIMARY KEY CLUSTERED ([ContactID] ASC),
    CONSTRAINT [FK_Contact_ContactType] FOREIGN KEY ([ContactTypeID]) REFERENCES [entity].[ContactType] ([ContactTypeID]),
    CONSTRAINT [FK_Contact_Entity] FOREIGN KEY ([EntityID]) REFERENCES [entity].[Entity] ([EntityID])
);

